package com.zl.freight.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

import com.zl.freight.service.LocationService;
import com.zl.freight.ui.activity.LoginActivity;
import com.zl.freight.utils.API;
import com.zl.freight.utils.SpUtils;

/**
 * Created by Administrator on 2018/4/10.
 */

public class BootReceiver extends BroadcastReceiver {
    static final String ACTION = "android.intent.action.BOOT_COMPLETED";

    @Override
    public void onReceive(Context context, Intent intent) {
//        Log.e("ACTION", ACTION);
//        Toast.makeText(context, "我开机启动啦", Toast.LENGTH_LONG).show();
//        if (intent.getAction().equals(ACTION)) {
//            //未登录返回
//            if (!SpUtils.isLogin(context)) {
//                return;
//            }
//            //不是司机返回
//            if (!SpUtils.getUserData(context).getUserRole().equals(API.DRIVER + "")) {
//                return;
//            }
//            //开启定位服务
//            context.startService(new Intent(context, LocationService.class));
//            context.startActivity(new Intent(context, LoginActivity.class));
//        }
    }
}
